$(document).ready(function(){
	var contextPath = document.location.pathname;
	var index = contextPath.substr(1).indexOf("/");
	contextPath = contextPath.substr(1, index);
	var basePath = "/" + contextPath;
	var radios = document.getElementsByName("isUse");
	
	
	for (var i = 0; i < radios.length; i++) {
        radios[i].indexs = i + 1;
        radios[i].onchange = function () {
            if (this.checked) {
            	
            	var addressId = $(this).attr("addressId");
            	alert("addressId-------------->"+addressId);
            	var queryUrl =basePath+"/HRTWEB/address/getAddress.do?id="+addressId;
            	$.ajax({
					url : queryUrl,
					dataType : 'json',
					cache : false,
					success : function(data) {
						var address = data.addressBook;
						alert(address.province);
						alert(address.postCode);
						alert(address.receiver);
						$("#receiver").attr("value",address.receiver);
						$("#postCode").attr("value",address.postCode);
						$("#province").attr("value",address.province);
					},
					error : function(html) {
						alert("出错了");
						return;
					}
				});
            }
        }
    }
	
	
});
function refresh() {
	window.location.reload();
}